$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'sys/flowTake/list',
        datatype: "json",
        colModel: [
            {label: '提现流水', name: 'yhbTakeNo', width: 80, key: true,align:"center"},
            {label: '姓名', name: 'username', width: 45,align:"center"},
            {label: '手机号码', name: 'phone', sortable: false, width: 65,align:"center"},
            {label: '提现时间', name: 'takeTime', width: 60,align:"center"},
            {label: '提现金额', name: 'takeAmount', width: 60,align:"center",formatter:function (value,options,row) {
                    return value.toFixed(2);
                }},
            {label: '实际到账', name: 'arrivalAmount', width: 60,align:"center",formatter:function (value,options,row) {
                    return value.toFixed(2);
                }},
            {label: '实时余额', name: 'currAvailableAmount',  width: 65,formatter:function (value,options,row) {
                    return value.toFixed(2);
                },align:"center"},
            {label: '实时提现后余额', name: 'currAfterAmount',  width: 65,align:"center",formatter:function (value,options,row) {
                    return value.toFixed(2);
                }},
            {label: '提现详细', name: 'explain',  width: 85,align:"center"},
            { label: '提现方式', name: 'takeType', width: 60, sortable: false,align:'center',formatter:function (value,options,row) {
                    return value==1?"连连支付":value==2?"随行付":value==3?"支付宝":"云结算";
                }}
        ],
        viewrecords: true,
        height: 385,
        rowNum: 10,
        rowList: [10, 30, 50],
        rownumbers: true,
        rownumWidth: 25,
        autowidth: true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader: {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames: {
            page: "page",
            rows: "limit",
            order: "order"
        },
        gridComplete: function () {
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
        }
    });


});

var vm = new Vue({
    el: '#rrapp',
    data: {
        q: {
            startTime:null,
            endTime:null,
            username: null,
            phone: null,
            takeState: ""
        },
        showList: true,
        title: null,
        takeStates:[{
            value:"",
            msg: "请选择提现状态"
        },{
            value:"SUCCESS",
            msg: "提现成功"
        },{
            value:"FAILURE",
            msg: "提现失败"
        },{
            value:"EXAMINE",
            msg: "审核中"
        }]

    },
    methods: {
        query: function () {
            vm.reload();
        },
        add: function () {
            vm.showList = false;
            vm.title = "新增";

        },

        update: function () {
            var userId = getSelectedRow();
            if (userId == null) {
                return;
            }

            vm.showList = false;
            vm.title = "修改";

        },
        reload: function () {
            vm.showList = true;
            var page = $("#jqGrid").jqGrid('getGridParam', 'page');
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {'username': vm.q.username,'phone':vm.q.phone,'takeState':vm.q.takeState,'startTime': vm.q.startTime,'endTime':vm.q.endTime},
                page: page
            }).trigger("reloadGrid");
        }
       
    }
});